 var table ,form ,laypage ,layer ,element ,laydate ,upload//时间组件 
$(function(){ 
	layui.use(['table','form','laypage','layer', 'element', 'laydate','upload'], function(){
        table = layui.table;
        form=layui.form;
        laypage = layui.laypage ;//分页
        layer = layui.layer ;//弹层
        element = layui.element; //元素操作
        laydate = layui.laydate; //时间组件 
        upload = layui.upload;
		//监听省份选择，联动市
	    form.on('select(Province)', function(num){
		  	  var provinceCode=num.value; //得到被选中的值
		  	  $("#cityCode option").not(":eq(0)").remove();//市清空
		       form.render();
	    	   var requestData = {"provinceCode": provinceCode};
	    	   $.ajax({
	    	          url: "/region/getCity.do",               //请求地址
	    	          data:formatParam(requestData),
	    	          type: "POST",              //请求类型
	    	          timeout: 200000,                //请求超时时间(毫秒)
	    	          headers: setHeader(),
	    	          success:function(data){         //请求成功
	    	        	  if(data.status == 200){
		   	        		   if(data.resultData.length>0){
		   			                $.each(data.resultData, function(i,json){
		   			                   $("#cityCode").append($("<option id='" + json["cityCode"] + "' value='" + json["cityCode"] + "'>" + json["cityName"] + "</option>"));
		   			                });
		   			                form.render();
		   	        		   }
		   	        	   }else{
		   	        		   layer.msg(data.resultMsg, {icon: 5});
		   	        	   }
	    	 				      
	    	           }
	    	   })       	             
	    });
   }) 	
})
/**
 *省份下拉
 */
function initProvinceById(method, id){    
	//请求
	$.ajax({
          url: "/region/getProvince.do",               //请求地址
          type: "POST",              //请求类型
          async:false,//请求类型
          timeout: 200000,                //请求超时时间(毫秒)
          headers: setHeader(),
          success:function(data){         //请求成功
        	  if(data.status == 200){
        		   if(data.resultData.length>0){
       	                $.each(data.resultData, function(i,json){
       	                   $("#"+id).append($("<option id='" + json["provinceCode"] + "' value='" + json["provinceCode"] + "'>" + json["provinceName"] + "</option>"));
       	                });
       	                form.render()
        		   }
        	   }else{
        		   layer.msg(data.resultMsg, {icon: 5});
        	   } 
 				      
         }
      })
}
 /**
  *市初始化
  */
 function initCityById(ele, provinceCode,cityCode){
       form.render();
	   var requestData = {"provinceCode": provinceCode};
	   $.ajax({
	          url: "/region/getCity.do",               //请求地址
	          data:formatParam(requestData),
	          type: "POST",              //请求类型
	          timeout: 200000,                //请求超时时间(毫秒)
	          headers: setHeader(),
	          success:function(data){         //请求成功
	        	  if(data.status == 200){
   	        		   if(data.resultData.length>0){
   			                $.each(data.resultData, function(i,json){
   			                   $("#"+ele).append($("<option id='" + json["cityCode"] + "' value='" + json["cityCode"] + "'>" + json["cityName"] + "</option>"));
   			                });
   			                form.render();
   	        		   }
   	        		   $("#"+ele).val(cityCode);
   	        		   form.render();
   	        	   }else{
   	        		   layer.msg(data.resultMsg, {icon: 5});
   	        	   }
	 				      
	           }
	   })       	             
}